package com.appspot.chooserepository.server;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class LastChangedDate {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private Date lastChanged;
	
	public LastChangedDate(Date lastChanged) {
		this.lastChanged = lastChanged;
	}

	public Key getKey() {
		return key;
	}

	public void setLastChanged(Date lastChanged) {
		this.lastChanged = lastChanged;
	}

	public Date getLastChanged() {
		return lastChanged;
	}	
	
	public Boolean isUpToDate(Date anotherDate) {
		return lastChanged.equals(anotherDate);
	}

}
